package com.example.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.plugins.Page;
import com.example.entity.SysUser;
import com.example.service.ISysUserService;
import com.example.utils.R;

/**
 * <p>
 * 系统用户  前端控制器
 * </p>
 *
 * @author lilufeng
 * @since 2016-11-28
 */
@RestController
@RequestMapping("/sysUser")
public class SysUserController {
	
	@Autowired
	private ISysUserService sysUserService;
	
	@RequestMapping("/getUsers")
	public List<SysUser> getUsers() {
		Page<SysUser> page = new Page<SysUser>();
		page.setCurrent(1);
		page.setSize(10);
		return sysUserService.selectPage(page).getRecords();
	}
	
	@RequestMapping("/add")
	public R add(SysUser sysUser) {
		boolean b = sysUserService.add(sysUser);
		if(b){
			return R.ok();
		}
		return R.error();
	}
}
